package com.indusfo.spc.controller;

import com.indusfo.spc.aspect.SystemControllerLog;
import com.indusfo.spc.pojo.Warehouse;
import com.indusfo.spc.service.WarehouseService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 仓库控制层
 */
@Controller
@RequestMapping("/warehouse")
public class WarehouseController {

    @Autowired
    private WarehouseService warehouseService;

    /**
     * 查询
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/queryWarehouse")
    @SystemControllerLog(description="查询")
    @ResponseBody
    public JSONObject queryWarehouse(Warehouse warehouse) {
        JSONObject json = warehouseService.selectWarehouse(warehouse);
        return json;
    }

    /**
     * 新增
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/insertWarehouse")
    @SystemControllerLog(description="新增")
    @ResponseBody
    public JSONObject insertWarehouse(Warehouse warehouse) {
        JSONObject json = warehouseService.insertWarehouse(warehouse);
        return json;
    }

    /**
     * 修改
     * @return
     */
    @RequestMapping(value = "/updateWarehouse")
    @SystemControllerLog(description="修改")
    @ResponseBody
    public JSONObject updateWarehouse(Warehouse warehouse){
        JSONObject json=warehouseService.updateWarehouse(warehouse);
        return json;
    }

    /**
     * 启用/停用/删除
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/definesWarehouse")
    @SystemControllerLog(description="启用/停用/删除")
    @ResponseBody
    public JSONObject definesWarehouse(Long[] warehouseIds, Integer dataState) {
        JSONObject json = warehouseService.definesWarehouse(warehouseIds, dataState);
        return json;
    }

}
